#!/usr/bin/env python

__author__ = "Abhinav Sarkar"
__version__ = "0.1"
__license__ = "GNU Lesser General Public License"

class Album (object):
	"""A class representing an album.

	The Album class exposes the following instance properties:

		album.artist
		album.name
		album.url
		album.coverart
		album.tracks
		
	The album class exposes the following instance methods:
		
		album.AsDict()
	"""
	def __init__(self,
				 artist = None,
				 name = None,
				 url = None,
				 coverart = None,
				 tracks = None):
		"""An object to hold an album.

		This class is normally instantiated by the Webservice class.

		Args:
			artist: an Artist object corresponding to this album's artist
			name: name of this album
			url: URL of this album on last.fm
			coverart:
				a dict having keys 'small', 'medium' and 'large' with the values as the
				URLs of the album coverart of respective sizes
			tracks:
				a list of Track objects corresponding to the tracks of this album

		Usage:
			>>> import audioscrobblerws
			>>> ws = audioscrobblerws.Webservice()
			>>> album = ws.GetAlbum('cross road', 'bon jovi')
		"""
		self.artist = artist
		self.name = name
		self.url = url
		self.coverart = coverart
		self.tracks = tracks

	def AsDict(self):
		"""Return self as a dict."""
		return self.__dict__

	def __eq__(self, other):
		return self.name == other.name and self.artist == other.artist

	def __ne__(self, other):
		return not self.__eq__(other)
